package com.bckj.fastboot.core.lang.exception;


import com.bckj.fastboot.core.extra.i18n.MessageUtils;
import com.bckj.fastboot.core.lang.enums.EnumMessage;
import lombok.Getter;

@Getter
public class BusinessException extends BaseException {
    private final Throwable cause = new RuntimeException("SentinelBlockException");

    public static BusinessException of(EnumMessage<Integer> em, Object... args) {
        String message = MessageUtils.message(em, args);
        return new BusinessException(em.getCode(), message);
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(int code, String message) {
        super(code, message);
    }

    public synchronized Throwable fillInStackTrace() {
        return this;
    }
}
